Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Server or client-side clock/date display

  1. #1

    Default Clock/date on-screen script?

    Hi all!

    Does anyone have any in-game onscreen "current date/clock scripts"?

    If it's possible?

    Server side or client side...

    I recall the great Elgan making one back in the day I think?

    Cheers!
    Last edited by OhGaz; May 15th, 2015 at 04:20 AM.

  2. #2
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    Any pro scripter could do it

  3. #3
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,071

    Default

    #include <time.h>
    #include <ctime>
    
    
    void timeStamp()
    {
    	// current date/time based on current system
    	time_t now = time(0);
    
    	// convert now to string form
    	char* dt = ctime(&now);
    
    
    	println dt
    }
    
    
    level waittill spawn
    main:
    
    
    while(1)
    {
    	timeStamp();
    	waitframe
    }
    end

  4. #4

  5. #5

    Default

    Thank you both for the advice.

    James, forgive my ignorance, but does that go into a relevant map's scr file...if so where?

    A little bit at odds as to how to get that working on the server - tried playing with it to no avail.

    Apologies - still learning.

    Cheers and thanks.

  6. #6
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,071

    Default

    Actually, I was being partially funny, because my syntax is half c++ and half moh scripting. :P
    Would be bad ass, if MOHAA actually understood the language like that, but unfortunately that's not the case.

    I'm not quite sure what functions actually control time in MOHAA, but I'm sure it's in the Documentation somewhere. I'll revisit your request if I get more information.

  7. #7
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    main:
    	while(1)
    	{
    		local.time = gettime(0)
    		huddraw_align 15 right top
    		huddraw_rect 15 -125 75 0 0
    		huddraw_font 15 "facfont-20"
    		huddraw_alpha 15 1
    		huddraw_color 15 1 1 1
    		huddraw_string 15 local.time
    		wait 1
    	}
    end

  8. #8
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    pffff james , the new coloring is bullshit for mohaa :L
    and ctrl+f5 doesn't work for chrome O.o

  9. #9

    Default

    Wow. Awesome! Works a treat. Thanks muchly, Ryback. 2 questions:

    1. How would one go about removing the "seconds" counting from that? And

    2. How would one go about "date"? Say for example: dd/mm/yy. I'm thinking something like local.date?

    Cheers and thanks again.
    Last edited by OhGaz; May 16th, 2015 at 03:43 AM.

  10. #10
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    545

    Default

    Yup

    local.date = getdate(0)
    Gets current date in format: dd.mm.yyyy

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •